﻿using ET.Monitor.DAL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.Monitor.Model
{
    public class OperationTicketModel
    {
        string id, userId, taskContent, dateTime, stationId,performance,state,owner;
        OperationTicketDAL dal = new OperationTicketDAL();

        public OperationTicketModel(string id)
        {
            this.id = id;
        }
        public OperationTicketModel(string id,string state, string performance)
        {
            this.id = id;
            this.state = state;
            this.performance = performance;
        }
        public OperationTicketModel(string id,string userId, string taskContent, string dateTime, string stationId,string ownerId)
        {
            this.id = id;
            this.userId = userId;
            this.taskContent = taskContent;
            this.dateTime = dateTime;
            this.stationId = stationId;
            this.owner = ownerId;
        }

        #region 新增工作票
        bool addOperationTicket;

        public bool AddOperationTicket
        {
            get { return dal.AddOperationTicketModel(userId, taskContent, dateTime, stationId,owner); }
            set { addOperationTicket = value; }
        }

        #endregion

        #region 删除工作票
        bool delOperationTicket;

        public bool DelOperationTicket
        {
            get { return dal.DeleteOperationTicketModel(id); }
            set { delOperationTicket = value; }
        }
        #endregion

        #region 修改工作票
        bool updateOperationTicket;

        public bool UpdateOperationTicket
        {
            get { return dal.UpdateOperationTicketModel(id,userId,taskContent,dateTime); }
            set { updateOperationTicket = value; }
        }
        #endregion

        #region 完成工作票
        bool feedbackTask;

        public bool FeedbackTask
        {
            get { return dal.FeedbackTask(id,state, performance) ; }
            set { feedbackTask = value; }
        }

        #endregion

        #region 根据Id查询task
        DataTable dtTask;
        public DataTable DtTask
        {
            get { return dal.GetTask(id); }
            set { dtTask = value; }
        }
        #endregion

    }
}
